home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWRgnShp.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.5 KB  |  155 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRgnShp.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRGNSHP_H
  11. #define FWRGNSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWDEBUG_H
  20. #include "FWDebug.h"
  21. #endif
  22.  
  23. // ----- OpenDoc Includes -----
  24.  
  25. #ifndef SOM_ODShape_xh
  26. #include <Shape.xh>
  27. #endif
  28.  
  29. #if FW_LIB_EXPORT_PRAGMAS
  30. #pragma lib_export on
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Declarations
  35. //========================================================================================
  36.  
  37. class FW_CLASS_ATTR FW_CGraphicContext;
  38.  
  39. //========================================================================================
  40. //    class FW_CRegionShape
  41. //========================================================================================
  42.  
  43. class FW_CLASS_ATTR FW_CRegionShape : public FW_CShape
  44. {
  45. public:
  46.     FW_DECLARE_CLASS
  47.  
  48. //----------------------------------------------------------------------------------------
  49. //    Constructors/Destructors
  50. //
  51. public:
  52.     FW_CRegionShape(ODShape* odShape,
  53.                     FW_ERenderVerbs renderVerb,
  54.                     const FW_PInk& ink = FW_kNormalInk,
  55.                     const FW_PStyle& style = FW_kNormalStyle);
  56.     
  57.     FW_CRegionShape(const FW_CRegionShape& other);
  58.     FW_CRegionShape(FW_CReadableStream& archive);
  59.     
  60.     virtual ~ FW_CRegionShape();
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    Operators
  64. //
  65. public:
  66.     FW_CRegionShape& operator=(const FW_CRegionShape& other);
  67.     
  68. //----------------------------------------------------------------------------------------
  69. //    Inherited API
  70. //
  71. public:
  72.     // ----- Hit Testing -----
  73.     virtual FW_Boolean     HitTest(FW_CGraphicContext& gc,
  74.                                     const FW_CPoint& test,
  75.                                     FW_CFixed tolerance) const;
  76.  
  77.     // ----- Copying -----
  78.     virtual FW_CShape*        Copy() const;
  79.     
  80.     // ----- Transform -----
  81.     virtual void            Transform(Environment* ev, ODTransform* odTransform);
  82.     virtual void            InverseTransform(Environment* ev, ODTransform* odTransform);
  83.  
  84.     virtual void            MoveShape(FW_CFixed deltaX, FW_CFixed deltaY);
  85.     virtual void            MoveShapeTo(FW_CFixed x, FW_CFixed y);
  86.  
  87.     virtual void            Inset(FW_CFixed h, FW_CFixed v);
  88.  
  89.     // ----- Geometry -----
  90.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  91.  
  92.     // ----- Rendering -----
  93.     virtual void            Render(FW_CGraphicContext& gc) const;
  94.     
  95.     // ----- Flatten -----
  96.     virtual void            Flatten(FW_CWritableStream& archive) const;
  97.     
  98. //----------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:    
  102.     // ----- Rendering -----
  103.     static void            RenderRegion(FW_CGraphicContext& gc,
  104.                                         ODShape* odShape,
  105.                                         FW_ERenderVerbs renderVerb,
  106.                                         const FW_PInk& ink = FW_kNormalInk,
  107.                                         const FW_PStyle& style = FW_kNormalStyle);
  108.     
  109.     // ----- Archiving -----
  110.     static void*             Read(FW_CReadableStream& archive);
  111.  
  112.     // ----- Getter/Setters -----
  113.     void                    GetGeometry(ODShape* odShape) const;        // returns a copy
  114.     void                    SetGeometry(ODShape* odShape);            // use a copy        
  115.     
  116.     ODShape*                GetODShape() const;                        // return fODShape                        
  117.     void                    AdoptODShape(ODShape* newODShape);        // Doesn't use a copy
  118.     ODShape*                OrphanODShape();                            //
  119.  
  120. private:
  121.     void                    DisposeODShape(Environment* ev);
  122.     
  123. //----------------------------------------------------------------------------------------
  124. //    Data Members
  125. //
  126. private:
  127.     ODShape                *fODShape;        
  128. };
  129.  
  130. //========================================================================================
  131. //    inlines
  132. //========================================================================================
  133.  
  134. //----------------------------------------------------------------------------------------
  135. //    FW_CRegionShape::GetODShape
  136. //----------------------------------------------------------------------------------------
  137. inline ODShape* FW_CRegionShape::GetODShape() const
  138. {
  139.     return fODShape;
  140. }
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    FW_CRegionShape::GetGeometry
  144. //----------------------------------------------------------------------------------------
  145. inline void FW_CRegionShape::GetGeometry(ODShape* odShape) const
  146. {
  147.     odShape->CopyFrom(somGetGlobalEnvironment(), fODShape);    // [HLX] for now
  148. }
  149.  
  150. #if FW_LIB_EXPORT_PRAGMAS
  151. #pragma lib_export off
  152. #endif
  153.  
  154. #endif
  155.